//
//  AddressManageCell.m
//  digitalCurrency
//
//  Created by 小震GG on 2019/11/6.
//  Copyright © 2019 XinHuoKeJi. All rights reserved.
//

#import "AddressManageCell.h"

@interface AddressManageCell()
@property (nonatomic, strong) UIView *bgView;

@end

@implementation AddressManageCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.backgroundColor = [UIColor clearColor];
        self.selectionStyle = NO;
        
        [self setView];
    }
    
    return self;
}

- (void)setView
{
    self.nameLB = [[UILabel alloc]init];
    [self addSubview:self.nameLB];
    [self.nameLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(20);
        make.top.equalTo(20);
    }];
    self.nameLB.textColor = tThreeColor;
    self.nameLB.font = kFont(12);
    
    self.bgView = [[UIView alloc]initWithFrame:CGRectMake(20, 44, kWindowW-40, 114)];
    [self addSubview:self.bgView];
    self.bgView.backgroundColor = [UIColor whiteColor];
    self.bgView.layer.cornerRadius = 6.0;
    self.bgView.layer.shadowColor = [UIColor colorWithHEX:@"6E6E6E"].CGColor;
    self.bgView.layer.shadowOffset = CGSizeMake(0, 0);
    self.bgView.layer.shadowOpacity = 0.21;
    
    UIView *lineView = [[UIView alloc]init];
    [self.bgView addSubview:lineView];
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(0);
        make.top.equalTo(40);
        make.height.equalTo(0.5);
    }];
    lineView.backgroundColor = tTableViewCellLine;
    
    UILabel *addrTitleLB = [[UILabel alloc]init];
    [self.bgView addSubview:addrTitleLB];
    [addrTitleLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.equalTo(14);
    }];
    addrTitleLB.textColor = tThreeColor;
    addrTitleLB.font = kFont(12);
    addrTitleLB.text = LocalizationKey(@"钱包地址");
    
    self.addressLB = [[UILabel alloc]init];
    [self.bgView addSubview:self.addressLB];
    [self.addressLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(addrTitleLB.mas_right).offset(14);
        make.right.equalTo(-20);
        make.centerY.equalTo(addrTitleLB);
    }];
    self.addressLB.textColor = tMainColor;
    self.addressLB.font = kFont(12);
    
    UILabel *noteTitleLB = [[UILabel alloc]init];
    [self.bgView addSubview:noteTitleLB];
    [noteTitleLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(14);
        make.top.equalTo(lineView.mas_bottom).offset(14);
    }];
    noteTitleLB.textColor = tThreeColor;
    noteTitleLB.font = kFont(12);
    noteTitleLB.text = LocalizationKey(@"备注信息");
    
    self.noteLB = [[UILabel alloc]init];
    [self.bgView addSubview:self.noteLB];
    [self.noteLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(addrTitleLB.mas_right).offset(14);
        make.right.equalTo(-20);
        make.centerY.equalTo(noteTitleLB);
    }];
    self.noteLB.textColor = tMainColor;
    self.noteLB.font = kFont(12);
    self.noteLB.numberOfLines = 0;
    
    self.deleteBtn = [[UIButton alloc]init];
    [self.bgView addSubview:self.deleteBtn];
    [self.deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(-9);
        make.bottom.equalTo(-8);
        make.height.equalTo(17);
    }];
    self.deleteBtn.layer.masksToBounds = YES;
    self.deleteBtn.layer.cornerRadius = 8.5;
    self.deleteBtn.backgroundColor = tMainColor;
    [self.deleteBtn setTitle:[NSString stringWithFormat:@"   %@   ",LocalizationKey(@"删除")] forState:UIControlStateNormal];
    self.deleteBtn.titleLabel.font = kFont(12);
    
    self.editBtn = [[UIButton alloc]init];
    [self.bgView addSubview:self.editBtn];
    [self.editBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.deleteBtn.mas_left).offset(-10);
        make.bottom.equalTo(-8);
        make.height.equalTo(17);
    }];
    self.editBtn.layer.masksToBounds = YES;
    self.editBtn.layer.cornerRadius = 8.5;
    self.editBtn.backgroundColor = tMainColor;
    [self.editBtn setTitle:[NSString stringWithFormat:@"   %@   ",LocalizationKey(@"编辑")] forState:UIControlStateNormal];
    self.editBtn.titleLabel.font = kFont(12);
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
